"""
下拉框
1 导入select类

"""

import time

from selenium import webdriver

from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
from selenium.webdriver.support.wait import WebDriverWait

driver=webdriver.Edge()
driver.maximize_window()
driver.get("http://localhost:8081/regA.html")
# 1 导入select类   Select(放select这个元素)
# 2 创建Select对象
select=Select(driver.find_element(By.CSS_SELECTOR,"#selectA"))
#3 执行Select里面的方法
# select.select_by_index(1)  #索引从0开始,不能为负
# select.select_by_value("gz") #选项的value属性值
select.select_by_visible_text("深圳")  #文本值





# 4 关闭浏览器驱动对象
time.sleep(30)  #代码暂停10s中
driver.quit()





